-
Notifications
You must be signed in to change notification settings - Fork 917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor getClient and getLegacyClient to use authentication method registry #5881
Refactor getClient and getLegacyClient to use authentication method registry #5881
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5881 +/- ##
==========================================
- Coverage 67.01% 67.00% -0.01%
==========================================
Files 3305 3307 +2
Lines 63585 63614 +29
Branches 10155 10163 +8
==========================================
+ Hits 42611 42627 +16
- Misses 18505 18518 +13
Partials 2469 2469
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
3468a37
to
c2c4bb9
Compare
c2c4bb9
to
95f3a54
Compare
@@ -14,6 +14,7 @@ export interface DataSourceAttributes extends SavedObjectAttributes { | |||
credentials: UsernamePasswordTypedContent | SigV4Content | undefined | AuthTypeContent; | |||
}; | |||
lastUpdatedTime?: string; | |||
name: AuthType | string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the difference of name vs auth.type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name can be any unique string to identify the authentication method.
auth.type is to specify using which method request needs to be signed. Right now we only have three ways: No auth, Basic authentication and AWS SigV4 authentication to sign the request.
So for example, I want to add new authentication method named abc
for role based authentication. So my plugin will do all the work such as assume role etc to get temporary credentials (Access key, secret key and session token) and provide those data source plugin and will ask to sign request using AWS SigV4 with provided credentials.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, just curious not a blocker, do we show name on the UI or is it solely used as identifier internally?
} = dataSourceAttr; | ||
const { endpoint: nodeUrl } = dataSourceAttr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we extract endpoint as before, eg. line 103
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nodeUrl
is never reassigned. Therefore I used const
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it!
Failed functional test is not related to the code change in this PR. |
95f3a54
to
f9ee790
Compare
f9ee790
to
deac092
Compare
…egistry Signed-off-by: Bandini Bhopi <[email protected]>
Signed-off-by: Bandini Bhopi <[email protected]>
d0b1d2b
deac092
to
d0b1d2b
Compare
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-5881-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 d56b04d0aac6aed21825f44eb70bb4a9b512dde0
# Push it to GitHub
git push --set-upstream origin backport/backport-5881-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x Then, create a pull request where the |
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-5881-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 d56b04d0aac6aed21825f44eb70bb4a9b512dde0
# Push it to GitHub
git push --set-upstream origin backport/backport-5881-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x Then, create a pull request where the |
…egistry (opensearch-project#5881) * Refactor getClient and getLegacyClient to use authentication method registry Signed-off-by: Bandini Bhopi <[email protected]> * Adds changelog and UT Signed-off-by: Bandini Bhopi <[email protected]> --------- Signed-off-by: Bandini Bhopi <[email protected]> (cherry picked from commit d56b04d)
…egistry (opensearch-project#5881) * Refactor getClient and getLegacyClient to use authentication method registry Signed-off-by: Bandini Bhopi <[email protected]> * Adds changelog and UT Signed-off-by: Bandini Bhopi <[email protected]> --------- Signed-off-by: Bandini Bhopi <[email protected]> (cherry picked from commit d56b04d)
…egistry (opensearch-project#5881) * Refactor getClient and getLegacyClient to use authentication method registry Signed-off-by: Bandini Bhopi <[email protected]> * Adds changelog and UT Signed-off-by: Bandini Bhopi <[email protected]> --------- Signed-off-by: Bandini Bhopi <[email protected]> (cherry picked from commit d56b04d)
…egistry (opensearch-project#5881) * Refactor getClient and getLegacyClient to use authentication method registry Signed-off-by: Bandini Bhopi <[email protected]> * Adds changelog and UT Signed-off-by: Bandini Bhopi <[email protected]> --------- Signed-off-by: Bandini Bhopi <[email protected]> (cherry picked from commit d56b04d)
…uthentication method registry (#5881) (#5940) * Refactor getClient and getLegacyClient to use authentication method registry (#5881) * Refactor getClient and getLegacyClient to use authentication method registry Signed-off-by: Bandini Bhopi <[email protected]> * Adds changelog and UT Signed-off-by: Bandini Bhopi <[email protected]> --------- Signed-off-by: Bandini Bhopi <[email protected]> (cherry picked from commit d56b04d) * Reverted accidental changes Signed-off-by: Bandini Bhopi <[email protected]> --------- Signed-off-by: Bandini Bhopi <[email protected]>
…egistry (opensearch-project#5881) * Refactor getClient and getLegacyClient to use authentication method registry Signed-off-by: Bandini Bhopi <[email protected]> * Adds changelog and UT Signed-off-by: Bandini Bhopi <[email protected]> --------- Signed-off-by: Bandini Bhopi <[email protected]>
Manual backport #5940 |
Description
Refactoring client and legacy client to use authentication registry.
Issues Resolved
Partially fixes #5692, #5838
Check List
yarn test:jest
yarn test:jest_integration